package com.example.demo1.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j

public class MqReceiver {
//    @RabbitListener(queuesToDeclare =@Queue("myQueue"))
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue("myQueue"),
            exchange =@Exchange("myExchangeQueue")
    ))
    public  void process(String message){

        log.info("MqReceiver: {}------------------------------------- 消息队列  ",message);
        System.out.println("MqReceiver: {}------------------------------------- 消息队列  "+message);
    }
}
